<?php

/**
 * This is the model class for table "sptpd_airtanah".
 *
 * The followings are the available columns in table 'sptpd_airtanah':
 * @property string $id_transaksi
 * @property string $nomor_urut
 * @property string $npwpd
 * @property string $nomor_sptpd
 * @property string $masa_pajak_abt
 * @property string $masa_pajak_terbilang_abt
 * @property string $tanggal_awal_abt
 * @property string $tanggal_akhir_abt
 * @property string $tahun_pajak_abt
 * @property string $tgl_sptpd_abt
 * @property string $id_rekening
 * @property string $no_rekening
 * @property string $cara_hitung
 * @property double $tarif_pajak
 * @property double $omzet
 * @property double $bunga_abt
 * @property double $denda_abt
 * @property double $total_pajak_abt
 * @property string $tanggal_abt
 * @property string $status_penetapan_abt
 * @property string $status_bayar_abt
 * @property string $status_aktif_abt
 * @property string $keterangan_abt
 * @property string $no_kohir_abt
 * @property string $sptpd_stat
 * @property string $user_operator
 * @property string $id_npa
 * @property string $jenis_sa
 * @property string $cara_hitung_abt
 * @property string $nama_sa
 * @property string $lokasi_sa
 * @property string $kelurahan_sa
 * @property string $kecamatan_sa
 * @property string $pemanfaatan_air
 * @property double $debet_air
 * @property double $jam
 * @property double $pengambilan_air_perbulan
 * @property string $hari
 * @property double $volume_air
 * @property double $harga_da
 * @property integer $kode_pajak
 *
 * The followings are the available model relations:
 * @property NilaiPerolehanAir $idNpa
 * @property Rekening $idRekening
 * @property Pajak $kodePajak
 * @property DataNpwpd $nomorUrut
 */
class SptpdAirtanah extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'sptpd_airtanah';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('id_transaksi', 'required'),
			array('kode_pajak', 'numerical', 'integerOnly'=>true),
			array('tarif_pajak, omzet, bunga_abt, denda_abt, total_pajak_abt, debet_air, jam, pengambilan_air_perbulan, volume_air, harga_da', 'numerical'),
			array('id_transaksi, nomor_sptpd, masa_pajak_terbilang_abt, no_kohir_abt', 'length', 'max'=>15),
			array('nomor_urut, cara_hitung_abt', 'length', 'max'=>10),
			array('npwpd, no_rekening', 'length', 'max'=>20),
			array('masa_pajak_abt, tahun_pajak_abt', 'length', 'max'=>4),
			array('cara_hitung, kecamatan_sa', 'length', 'max'=>5),
			array('status_penetapan_abt, status_bayar_abt, status_aktif_abt, sptpd_stat', 'length', 'max'=>2),
			array('user_operator, jenis_sa', 'length', 'max'=>35),
			array('nama_sa, kelurahan_sa', 'length', 'max'=>50),
			array('lokasi_sa, pemanfaatan_air', 'length', 'max'=>75),
			array('tanggal_awal_abt, tanggal_akhir_abt, tgl_sptpd_abt, id_rekening, tanggal_abt, keterangan_abt, id_npa, hari', 'safe'),
			// The following rule is used by search().
			// @todo Please remove those attributes that should not be searched.
			array('id_transaksi, nomor_urut, npwpd, nomor_sptpd, masa_pajak_abt, masa_pajak_terbilang_abt, tanggal_awal_abt, tanggal_akhir_abt, tahun_pajak_abt, tgl_sptpd_abt, id_rekening, no_rekening, cara_hitung, tarif_pajak, omzet, bunga_abt, denda_abt, total_pajak_abt, tanggal_abt, status_penetapan_abt, status_bayar_abt, status_aktif_abt, keterangan_abt, no_kohir_abt, sptpd_stat, user_operator, id_npa, jenis_sa, cara_hitung_abt, nama_sa, lokasi_sa, kelurahan_sa, kecamatan_sa, pemanfaatan_air, debet_air, jam, pengambilan_air_perbulan, hari, volume_air, harga_da, kode_pajak', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'idNpa' => array(self::BELONGS_TO, 'NilaiPerolehanAir', 'id_npa'),
			'idRekening' => array(self::BELONGS_TO, 'Rekening', 'id_rekening'),
			'kodePajak' => array(self::BELONGS_TO, 'Pajak', 'kode_pajak'),
			'nomorUrut' => array(self::BELONGS_TO, 'DataNpwpd', 'nomor_urut'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id_transaksi' => 'Id Transaksi',
			'nomor_urut' => 'Nomor Urut',
			'npwpd' => 'Npwpd',
			'nomor_sptpd' => 'Nomor Sptpd',
			'masa_pajak_abt' => 'Masa Pajak Abt',
			'masa_pajak_terbilang_abt' => 'Masa Pajak Terbilang Abt',
			'tanggal_awal_abt' => 'Tanggal Awal Abt',
			'tanggal_akhir_abt' => 'Tanggal Akhir Abt',
			'tahun_pajak_abt' => 'Tahun Pajak Abt',
			'tgl_sptpd_abt' => 'Tgl Sptpd Abt',
			'id_rekening' => 'Id Rekening',
			'no_rekening' => 'No Rekening',
			'cara_hitung' => 'Cara Hitung',
			'tarif_pajak' => 'Tarif Pajak',
			'omzet' => 'Omzet',
			'bunga_abt' => 'Bunga Abt',
			'denda_abt' => '
',
			'total_pajak_abt' => 'Total Pajak Abt',
			'tanggal_abt' => 'Tanggal Abt',
			'status_penetapan_abt' => 'Status Penetapan Abt',
			'status_bayar_abt' => 'Status Bayar Abt',
			'status_aktif_abt' => 'Status Aktif Abt',
			'keterangan_abt' => 'Keterangan Abt',
			'no_kohir_abt' => 'No Kohir Abt',
			'sptpd_stat' => 'Sptpd Stat',
			'user_operator' => 'User Operator',
			'id_npa' => 'Id Npa',
			'jenis_sa' => 'Jenis Sa',
			'cara_hitung_abt' => 'Cara Hitung Abt',
			'nama_sa' => 'Nama Sa',
			'lokasi_sa' => 'Lokasi Sa',
			'kelurahan_sa' => 'Kelurahan Sa',
			'kecamatan_sa' => 'Kecamatan Sa',
			'pemanfaatan_air' => 'Pemanfaatan Air',
			'debet_air' => 'Debet Air',
			'jam' => 'Jam',
			'pengambilan_air_perbulan' => 'Pengambilan Air Perbulan',
			'hari' => 'Hari',
			'volume_air' => 'Volume Air',
			'harga_da' => 'Harga Da',
			'kode_pajak' => 'Kode Pajak',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 *
	 * Typical usecase:
	 * - Initialize the model fields with values from filter form.
	 * - Execute this method to get CActiveDataProvider instance which will filter
	 * models according to data in model fields.
	 * - Pass data provider to CGridView, CListView or any similar widget.
	 *
	 * @return CActiveDataProvider the data provider that can return the models
	 * based on the search/filter conditions.
	 */
	public function search()
	{
		// @todo Please modify the following code to remove attributes that should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id_transaksi',$this->id_transaksi,true);
		$criteria->compare('nomor_urut',$this->nomor_urut,true);
		$criteria->compare('npwpd',$this->npwpd,true);
		$criteria->compare('nomor_sptpd',$this->nomor_sptpd,true);
		$criteria->compare('masa_pajak_abt',$this->masa_pajak_abt,true);
		$criteria->compare('masa_pajak_terbilang_abt',$this->masa_pajak_terbilang_abt,true);
		$criteria->compare('tanggal_awal_abt',$this->tanggal_awal_abt,true);
		$criteria->compare('tanggal_akhir_abt',$this->tanggal_akhir_abt,true);
		$criteria->compare('tahun_pajak_abt',$this->tahun_pajak_abt,true);
		$criteria->compare('tgl_sptpd_abt',$this->tgl_sptpd_abt,true);
		$criteria->compare('id_rekening',$this->id_rekening,true);
		$criteria->compare('no_rekening',$this->no_rekening,true);
		$criteria->compare('cara_hitung',$this->cara_hitung,true);
		$criteria->compare('tarif_pajak',$this->tarif_pajak);
		$criteria->compare('omzet',$this->omzet);
		$criteria->compare('bunga_abt',$this->bunga_abt);
		$criteria->compare('denda_abt',$this->denda_abt);
		$criteria->compare('total_pajak_abt',$this->total_pajak_abt);
		$criteria->compare('tanggal_abt',$this->tanggal_abt,true);
		$criteria->compare('status_penetapan_abt',$this->status_penetapan_abt,true);
		$criteria->compare('status_bayar_abt',$this->status_bayar_abt,true);
		$criteria->compare('status_aktif_abt',$this->status_aktif_abt,true);
		$criteria->compare('keterangan_abt',$this->keterangan_abt,true);
		$criteria->compare('no_kohir_abt',$this->no_kohir_abt,true);
		$criteria->compare('sptpd_stat',$this->sptpd_stat,true);
		$criteria->compare('user_operator',$this->user_operator,true);
		$criteria->compare('id_npa',$this->id_npa,true);
		$criteria->compare('jenis_sa',$this->jenis_sa,true);
		$criteria->compare('cara_hitung_abt',$this->cara_hitung_abt,true);
		$criteria->compare('nama_sa',$this->nama_sa,true);
		$criteria->compare('lokasi_sa',$this->lokasi_sa,true);
		$criteria->compare('kelurahan_sa',$this->kelurahan_sa,true);
		$criteria->compare('kecamatan_sa',$this->kecamatan_sa,true);
		$criteria->compare('pemanfaatan_air',$this->pemanfaatan_air,true);
		$criteria->compare('debet_air',$this->debet_air);
		$criteria->compare('jam',$this->jam);
		$criteria->compare('pengambilan_air_perbulan',$this->pengambilan_air_perbulan);
		$criteria->compare('hari',$this->hari,true);
		$criteria->compare('volume_air',$this->volume_air);
		$criteria->compare('harga_da',$this->harga_da);
		$criteria->compare('kode_pajak',$this->kode_pajak);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}

	/**
	 * Returns the static model of the specified AR class.
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
	 * @param string $className active record class name.
	 * @return SptpdAirtanah the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}
